Add a checkbox to create a baseline before running the script

Hello,

My requirements are:

1. I have to add new checkbox to create a new baseline before creating the test run which my script was doing before(already existing script).

2. The description field in the new baseline dialogue shall contain the following text:
"Baseline before creation of testrun <testrun ID>", where <testrun ID> shall be substitued by the name of the testrun the GUI is currently generating.

I have already done the scripting part to add the new checkbox but the DIALOG BOX for creating new baseline is appearing before the actual GUI, But I need the create baseline only after clicking on CREATE button on GUI.

I am also getting the following run time error:

-R-E- DXL: <Line:672> array bounds exceeded (-1)
Backtrace:
    <Line:672>
    <Line:1120>
    <Line:1134>
-I- DXL: execution halted

Can any one please help me out.

I have also attached my script.

 


KBSri - Tue Jun 17 05:32:09 EDT 2014

Re: Add a checkbox to create a baseline before running the script
SudarshanRao - Tue Jun 17 06:38:00 EDT 2014

I've not checked through the complete script. But I see the following include statement in the beginning of the script:
#include <standard\\baseline\\createBaseline.inc>

This statement will bring up the baseline creation dialog box you're referring to. (Just running the above line itself is sufficient to bring up the baseline creation dialog box)
Are you using createBaseline.inc file above to create the baseline UI?
If you are using this file directly to create the baseline dialog, then you can insert the include statement within an IF condition - so that its included only when you need to show it. If that's feasible for the functionality of your script...

About the errors, I don't see the line numbers you mention (1198 or 1212). Maybe you're using a different version of the script?
Looking at the error, it could be that you are trying to modify an enumerated attribute definition incorrectly.. or doing something wrong with arrays itself..

Re: Add a checkbox to create a baseline before running the script
KBSri - Tue Jun 17 08:16:00 EDT 2014

SudarshanRao - Tue Jun 17 06:38:00 EDT 2014

I've not checked through the complete script. But I see the following include statement in the beginning of the script:
#include <standard\\baseline\\createBaseline.inc>

This statement will bring up the baseline creation dialog box you're referring to. (Just running the above line itself is sufficient to bring up the baseline creation dialog box)
Are you using createBaseline.inc file above to create the baseline UI?
If you are using this file directly to create the baseline dialog, then you can insert the include statement within an IF condition - so that its included only when you need to show it. If that's feasible for the functionality of your script...

About the errors, I don't see the line numbers you mention (1198 or 1212). Maybe you're using a different version of the script?
Looking at the error, it could be that you are trying to modify an enumerated attribute definition incorrectly.. or doing something wrong with arrays itself..

Hello Sudharsan,

Thanks a lot for your response.It was different version. I have edited now  and update the new script in the same post the error is in the following line:

-R-E- DXL: <Line:672> array bounds exceeded (-1) : sTestRunNumber = ((GetTestRunCount(sProjects[iProject]) + 1)"")

I tried giving the following declaration inside the following IF statement but I was getting error.

The line which I inserted is  :  if (get(dbeCreateBaseline) == 0)
    {

#include <standard\\baseline\\createBaseline.inc>

Errors are:

-E- DXL: <standard/baseline/baselineList.inc:23> non local variable access (listItems)
-E- DXL: <standard/baseline/baselineList.inc:33> non local variable access (BASELINE_NAME_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:34> non local variable access (BASELINE_CREATED_BY_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:35> non local variable access (BASELINE_CREATED_ON_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:36> non local variable access (BASELINE_DELETED_BY_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:37> non local variable access (BASELINE_DELETED_ON_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:60> non local variable access (BASELINE_CREATED_BY_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:61> non local variable access (BASELINE_CREATED_ON_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:69> non local variable access (BASELINE_DELETED_BY_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:70> non local variable access (BASELINE_DELETED_ON_COLUMN)
  too many messages -- suspending error reporting-I- DXL: All done. Errors reported: 187. Warnings reported: 0.

 

Re: Add a checkbox to create a baseline before running the script
SudarshanRao - Tue Jun 17 09:23:02 EDT 2014

KBSri - Tue Jun 17 08:16:00 EDT 2014

Hello Sudharsan,

Thanks a lot for your response.It was different version. I have edited now  and update the new script in the same post the error is in the following line:

-R-E- DXL: <Line:672> array bounds exceeded (-1) : sTestRunNumber = ((GetTestRunCount(sProjects[iProject]) + 1)"")

I tried giving the following declaration inside the following IF statement but I was getting error.

The line which I inserted is  :  if (get(dbeCreateBaseline) == 0)
    {

#include <standard\\baseline\\createBaseline.inc>

Errors are:

-E- DXL: <standard/baseline/baselineList.inc:23> non local variable access (listItems)
-E- DXL: <standard/baseline/baselineList.inc:33> non local variable access (BASELINE_NAME_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:34> non local variable access (BASELINE_CREATED_BY_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:35> non local variable access (BASELINE_CREATED_ON_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:36> non local variable access (BASELINE_DELETED_BY_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:37> non local variable access (BASELINE_DELETED_ON_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:60> non local variable access (BASELINE_CREATED_BY_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:61> non local variable access (BASELINE_CREATED_ON_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:69> non local variable access (BASELINE_DELETED_BY_COLUMN)
-E- DXL: <standard/baseline/baselineList.inc:70> non local variable access (BASELINE_DELETED_ON_COLUMN)
  too many messages -- suspending error reporting-I- DXL: All done. Errors reported: 187. Warnings reported: 0.

 

About the array related error:

So it appears like there's some calculation going wrong with sProjects[], you'll probably need to insert some debug statements in your script to figure out what's going beyond the array size..

About createBaseline.inc, I should have mentioned that you can't use that #include from within a function though.. So you'll have to either alter the flow of the script such that the #include statement isn't within a function, or create your own dialog box for baseline creation as well..

Re: Add a checkbox to create a baseline before running the script
llandale - Tue Jun 17 11:41:56 EDT 2014

Array: This error indicates your array index is -1:

  • -R-E- DXL: <Line:672> array bounds exceeded (-1)

Lines 671 and 672 are:

  • iProject = get(dbeProjectName)   
  • sTestRunNumber = ((GetTestRunCount(sProjects[iProject]) + 1)"")

Clearly dialog element "dbeProjectName" has nothing in it, iProject ends up being "-1", and the sProjects[] lookup fails.  You should insert something like this:

  • if (iProject < 0) //
  • then warningBox("Select a Project")
  • else
  • {  proceed with the code
  • }

Include: Invoking native include files can be tricky.  In this case the include file defines the dialog AND then "show"s it.  I'm not very good at this myself, but your choices are:

  • Override the native "show" (or is it the "block") command, so when you issue the $include it doesn't actually do anything.
  • Issue the include via an "eval_" statement, sending it the name of the current folder.

Someone else will need to help with that.

Attempting to put the #include in a conditional statement will fail.  DXL disallows normal nesting of variables; all globabl variables MUST be at the global context, and putting it into an "if" statement puts it in a non-global context:

  • This statement is in the global context
  • if (whatever)
  • {  This statement is within the "if" context, and is not global
  • }

And I'd like to point out that the #include reference is resolved when the code is interpreted; so you clearly cannot use conditional logic to determine which #include to actually use.

-Louie

Re: Add a checkbox to create a baseline before running the script
KBSri - Mon Jun 30 05:18:48 EDT 2014

Please help me.

Re: Add a checkbox to create a baseline before running the script
7XUT_Antonio_Norkus - Mon Jun 30 10:16:59 EDT 2014

The only way I've found of preventing #include of a file, is to halt the script before the inclusion. E.g.:

if (!confirm("baseline?")) halt
#include <standard\baseline\createBaseline.inc>

It may be possible to restructure the workflow to use this approach.

Re: Add a checkbox to create a baseline before running the script
llandale - Mon Jun 30 14:54:01 EDT 2014

KBSri - Mon Jun 30 05:18:48 EDT 2014

Please help me.

Glancing at the code, I see lines 1260/1261:

  •  block dbCreateTestRun
  •  doCreateBaseline(dbeProjectName)     //<< remove this line

That means after the dialog gets "released", it will create the baseline.  I see it is "released" in your "close" function "CloseDB" (line 995).  Clearly you don't want to do that.

I see that "doCreateBaseline()" is tied to your checkBox dbeCreateBaseline (line 1114); no doubt that is when you want to perform the baseline.

-Louie

Here is an artical on construction of a "block" dialog:

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014482773&ps=25

 

Re: Add a checkbox to create a baseline before running the script
KBSri - Wed Jul 02 10:29:28 EDT 2014

llandale - Mon Jun 30 14:54:01 EDT 2014

Glancing at the code, I see lines 1260/1261:

  •  block dbCreateTestRun
  •  doCreateBaseline(dbeProjectName)     //<< remove this line

That means after the dialog gets "released", it will create the baseline.  I see it is "released" in your "close" function "CloseDB" (line 995).  Clearly you don't want to do that.

I see that "doCreateBaseline()" is tied to your checkBox dbeCreateBaseline (line 1114); no doubt that is when you want to perform the baseline.

-Louie

Here is an artical on construction of a "block" dialog:

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014482773&ps=25

 

Thank you all . I resolved it. Thanks a ton louie :)